require 'sidekiq/web'
Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]

Rails.application.routes.draw do

  namespace :log do
    resources :login_histories
  end
  resources :customers
  namespace :sales do
    resources :invoices
  end
  namespace :sales do
    resources :orders
  end
  namespace :sales do
    resources :quotations
  end
  namespace :sales do
    resources :follow_ups do
      collection do
        get :calendar
      end
    end
  end
  namespace :sales do
    resources :finance_infos
  end
  namespace :sales do
    resources :contacts
  end
  namespace :sales do
    resources :firms do
      collection do
        get :my_leads
        get :detail_edit
        post :detail_save
      end

      member do
        get :grab
      end
    end
  end
  namespace :base do
    resources :positions
  end
  namespace :base do
    resources :user_positions
  end
  namespace :base do
    resources :team_members
  end
  namespace :base do
    resources :teams
  end
  namespace :base do
    resources :branch_offices
  end
  namespace :base do
    resources :departments
  end
  namespace :base do
    resources :users
    resources :notices
  end


  resources :users
  # writer your routes here

  mount Sidekiq::Web => '/sidekiq'
  mount StatusPage::Engine => '/'
  mount ExceptionTrack::Engine => "/exception-track"
  #mount ActionCable.server => '/cable'
  root to: 'sales/firms#my_leads'
end

handle = Rails.env.production? ? method(:require) : method(:load)

Dir.glob(File.join(Rails.root, 'config', 'routes', '*.rb'), &handle)